<template>
  <div>钩子函数</div>
</template>

<script>
import {
  onBeforeMount,
  onMounted,
  onBeforeUpdate,
  onUpdated,
  onBeforeUnmount,
  onUnmounted,
} from "vue";
export default {
  setup() {
    // beforeCreate(() => {
    //   console.log("beforeCreate1");
    // });
    //   BeforeMount
    onBeforeMount(() => {
      {
        console.log("钩子3");
      }
    });
    // Mounted
    onMounted(() => {
      {
        console.log("钩子4");
      }
    });
    // BeforeUpdate
    onBeforeUpdate(() => {
      {
        console.log("钩子5");
      }
    });
    // Updated
    onUpdated(() => {
      {
        console.log("钩子6");
      }
    });
    // beforeDestroy
    onBeforeUnmount(() => {
      {
        console.log("钩子7");
      }
    });
    // destroy
    onUnmounted(() => {
      {
        console.log("钩子8");
      }
    });
  },

  beforeCreate() {
    console.log("beforeCreate1");
  },
  created() {
    console.log("created2");
  },
};
</script>

<style>
</style>